Skip to main content

All Questions

0votes
2answers
44views

Capture and print on the exact match from a file

I am trying to use grep to match only a specific part of a row in a file. The file is a huge csv file with some columns containing json with commas so it is hard to figure out which column what I am ...
smith's user avatar
0votes
1answer
85views

How to run a command that requires input/output location on all folders in a directory, while correspondingly naming the new output folders?

For context, I have some experience with Unix and basic commands, but I'm seriously struggling to conceptualize more complex manipulations of files. Essentially, I have this command I want to run from ...
avery's user avatar
1vote
1answer
3kviews

jq select match pattern but not if preceded by other pattern

An application called "vagrant packer" always downloads the iso and checksum file from the remote location every time I run it, so I'm creating a script that downloads the iso to a local ...
Folaht's user avatar
  • 1,156
1vote
1answer
112views

How to delete a string in my files?

So I want to match all below then remove those lines of string. [MTT-5634](https://my.atlassian.net/browse/MTT-5634) [MCC-123](https://my.atlassian.net/browse/MCC-123) [MTT-7965]: https://my.atlassian....
Beelzebub's user avatar
1vote
1answer
1kviews

regexp to only extract first set/group of numbers from line of string from a file

How can I use regexp to extract first set/group of numbers from line of string from a file and ignore lines that have two set of numbers, any symbol (except PASS_MAX_DAYS), and have it show on the ...
JakePaul's user avatar
-1votes
2answers
123views

line start string and end string matches then it needs to replace end string of a line and ignore any string that matches in between of same line

Require a shell script for the below issue elecj_test: |1009676|F|269.13348200|3|348415|237.06|0.00|0.00|||SSPPPSSSPSSS|UNTESTED|| If a line starts with elecj_test: and ends with || it needs to ...
sathavahana's user avatar
0votes
1answer
211views

Remove certain words and set word at end of string in files

I have a bunch of files that contain strings similar to: Get<1>(abc) Get<2>(xyz) How can I recursively search for all files with the above pattern and remove everything before the first '(...
aWLW's user avatar
  • 133
0votes
2answers
207views

move recently created files matching a pattern from one folder to a different one

I am looking for a bash script example which does the following: I have files being written under /tmp folder I do at the xterm prompt, ls -ltr which gives me a list of recent files such as: ...
Eric's user avatar
0votes
1answer
418views

Passing arguments into a glob pattern within a script

I have a script called get_numbers.sh, which I want to use to extract data from .pdf files labelled sequentially by date, using pdfgrep. Let me simplify my problem to what I believe are its essentials:...
nonreligious's user avatar
1vote
2answers
414views

How to introduce support for command line options in a script that is written to use positional arguments?

I have a script that is currently used with positional arguments, like this: ./script.sh fname lname address I want to also support ordinary command line options when I call this script, so that I ...
Ferenc's user avatar
0votes
1answer
163views

how to use xargs to extract a list of names from IRC

Using the finch IRC client, I copy/pasted a list of names to names.txt for processing. Basically, the names are seperated by spaces. Many of the names will have special characters like "/" ...
Nicholas Saunders's user avatar
1vote
1answer
105views

Best way to access files inside of directories with common part of dirname

the title is not self-explanatory at all, but I don't know how to formulate it correctly. I will explain with an example. I have a directory structure like this: results/ test_0_part1_x000/ ...
panc_fab's user avatar
-1votes
1answer
35views

Finding error in my script

I have a messy script which should get the name of the site (like https://google.com/etc): #!/bin/bash ARTIST=$(echo "$@" | grep -oP 'https:\\/\\/\\K.+?(?=.com)' | sed -e "s/\b\(.\)/\u\...
Casual's user avatar
3votes
1answer
6kviews

Shellscript match regex

I am trying to check if a variable matches a regex in POSIX shell. However, this seems more difficult than I thought. I am trying to check if the variable is a valid size string (e.g. 10M or 6G etc) ...
user4042470's user avatar
1vote
2answers
332views

Finding a string in a txt of house addresses with number ranges by passing in exact number and street names

Context I'm a postal worker (mail sorter) and am trying to write a bash script which allows me to input an exact street address and first couple letters of a street name, and have it return the ...
YMGenesis's user avatar

153050per page
close